<?php
    session_start();
    $data = $_GET;
    if(empty($data['id'])){
        echo '<script>window.location.href = "index.php"</script>';
    }
    $connect = mysqli_connect('localhost','root','root','db_info');
    $result = mysqli_query($connect,"select * from tb_article where id = '".$data['id']."' limit 1");
    $res = mysqli_fetch_assoc($result);
?>
<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/header.css">
    <link rel="stylesheet" href="./css/loginLayout.css">
    <link rel="stylesheet" href="./css/footer.css">
    <style>
        body{
            background-color: #000;
        }
        .innerA{
            margin: 90px auto 0;
            color: #fff;
        }
        .hide{
            top: -45px;
        }
        .title{
            text-align: center;
            margin-top: 50px;
            margin-bottom: 30px;
            font-weight: bold;
            font-size: 30px;
        }
        .infoForArc{
            margin-top: 20px;
            margin-bottom: 20px;
            font-size: 21px;
        }
        .main{
            line-height: 200%;
            overflow: hidden;
        }
    </style>
</head>
<body>
<?php include_once 'header.php'?>
<main>
    <div class="innerA container clearfix">
        <div class="title">
            <?php echo $res['title']?>
        </div>
        <div class="infoForArc clearfix">
            <span class="release_time">发布时间：<?php echo $res['release_time']?></span>
            <span class="user">作者：<?php
                $resultUser = mysqli_query($connect,"SELECT * FROM tb_user WHERE uid = '". $res['user_id'] ."'");
                $resUser = mysqli_fetch_assoc($resultUser);
                echo $resUser['username'];
                ?></span>
        </div>
        <div class="main">
            <?php
                echo $res['text'];
            ?>
        </div>
    </div>
</main>
<?php include_once 'footer.php'?>
<?php include_once 'loginLayout.php';?>
</body>
<script src="./js/jquery-3.5.1.js"></script>
<script src="./js/header.js"></script>
<script src="./js/tools.js"></script>
</html>